﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading;

namespace VoiceAd.Controllers
{
    public abstract class MultiLangController : Controller
    {
        protected override void ExecuteCore()
        {
            string strCur = null;
            string strLang = null;

            HttpCookie objCook = Request.Cookies["TamAnLang"];
            if (objCook != null)
            {
                strLang = objCook.Value;
                switch (strLang.ToLower())
                {
                    case "vn":
                        strCur = "vi-VN";
                        break;
                    case "en":
                        strCur = "en-US";
                        break;
                }
            }
            else
            {
                strCur = "vi-VN";
            }
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(strCur);
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
            base.ExecuteCore();
        }
    }
}
